var gulp = require('gulp');
var gulpif = require('gulp-if');
var rev = require('gulp-rev');
var revCollector = require('gulp-rev-collector');
var livereload = require('gulp-livereload');
var minifyHtml = require('gulp-minify-html');
var fileinclude  = require('gulp-file-include');
var config = require('../config').html;
var configDes = require('../config').des;

gulp.task('html', function () {
    return gulp.src([config.src, '!src/include/**.html'])
        .pipe(fileinclude({
          prefix: '@@',
          basepath: '@file'
        }))
        .pipe(gulpif(global.isProd, gulp.src([configDes.all, config.src])))
        .pipe(gulpif(global.isProd, revCollector()))
        /*.pipe(gulpif(global.isProd, minifyHtml({
          empty: true,
          spare: true,
          quotes: true
        }))*/
        .pipe(gulp.dest(config.dest))
        .pipe(livereload())
});
